package com.quanshu.change.person.adapter;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.quanshu.change.person.entity.GoldListEntity;
import com.quanshu.exchange.R;

import java.util.List;

/**
 * 作者  李哲
 * 创建时间 2018/9/2
 * 邮箱 lizhetongliao@163.com
 * 说明
 **/
public class GoldListAdapter extends BaseQuickAdapter<GoldListEntity, BaseViewHolder> {
    public GoldListAdapter(@Nullable List<GoldListEntity> data) {
        super(R.layout.item_gold_list, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, GoldListEntity item) {
        helper.setText(R.id.txt1, item.getContent());
        helper.setText(R.id.txt3, "余额：" + item.getGold_bean());
        helper.setText(R.id.txt4, item.getCreate_time());
        TextView textView = helper.getView(R.id.txt2);
        if (item.getIncrease() > 0) {
            textView.setText("+" + item.getIncrease());
            textView.setTextColor(Color.parseColor("#C24646"));
        } else if (item.getReduce() > 0) {
            textView.setText("-"+item.getReduce());
            textView.setTextColor(Color.parseColor("#5D76A9"));
        }
    }
}
